﻿<!DOCTYPE html>

<html lang="zh-cn" xmlns="http://www.w3.org/1999/xhtml">
<!-- saved from url=(0013)about:internet -->
<head>
    <meta charset="utf-8" http-equiv="X-UA-Compatible" content="IE=5,6,7,8,9,10,11, chrome=1" />
    <title>ECharts</title>
    <style>
        #main {
            width: 97%;
            height: 97%;
            position: absolute;
        }
    </style>
</head>

<body>
    <div id="main" />
    <script src="echarts.js"></script>
    <script>
        myChart = echarts.init(document.getElementById('main'));
        option = {
            xAxis: {
                type: 'category',
                data: []
            },
            yAxis: {
                type: 'value'
            },
            series: [{
                data: [],
                type: 'line',
                smooth: true
            }, {
                data: [],
                type: 'line',
                smooth: true
            }, {
                data: [],
                type: 'line',
                smooth: true
            }, {
                data: [],
                type: 'line',
                smooth: true
            }, {
                data: [],
                type: 'line',
                smooth: true
            }, {
                data: [],
                type: 'line',
                smooth: true
            }, {
                data: [],
                type: 'line',
                smooth: true
            }, {
                data: [],
                type: 'line',
                smooth: true
            }
            ]
        };
        myChart.setOption(option);

        function jsShowHide(info) {
            if (info == 0) {
                myChart.clear();
            }
            else {
                myChart.setOption(option);
            }
        }
        function jsPushData(x, y, index) {
            option.xAxis.data.push(x);
            option.series[index].data.push(y);
            myChart.setOption(option);
        }

        function jsPushXData(x) {
            option.xAxis.data.push(x);
            myChart.setOption(option);
        }

        function jsPushYData(y, index) {
            option.series[index].data.push(y);
            myChart.setOption(option);
        }

         function jsShiftData(x, y, index) {
            option.xAxis.data.shift();
            option.series[index].data.shift();
            myChart.setOption(option);
        }

        function jsShiftXData(x) {
            option.xAxis.data.shift();
            myChart.setOption(option);
        }

        function jsShiftYData(y, index) {
            option.series[index].data.shift();
            myChart.setOption(option);
        }

        function jsSetDatas(xArray, yArray, index) {
            option.xAxis.data = JSON.parse(xArray);
            option.series[index].data = JSON.parse(yArray);
            myChart.setOption(option);
        }

        function jsSetXDatas(xArray) {
            option.xAxis.data = JSON.parse(xArray);
            myChart.setOption(option);
        }

        function jsSetYDatas(yArray, type, index) {
            option.series[index].data = JSON.parse(yArray);
            option.series[index].type = type;
            myChart.setOption(option);
        }

        function jsSetSmooth(smooth, index) {
            option.series[index].smooth = smooth;
            myChart.setOption(option);
        }

        function jsSetSize(x, y) {
            var main = document.getElementById('main')
            main.style.width = x + "px"
            main.style.height = y + "px"
            myChart.resize({ width: x, height: y });
        }

        function click1() {
            //var main = document.getElementById('main')
            //main.style.width = "500px"
            //main.style.height = "500px"
            //myChart.resize({ height: 500, width:500 });
            window.external.ShowMsg("这是一条信息,来自js，调用了C#");
        }

    </script>
</body>
</html>